import java.util.Random;
import java.util.Scanner;
import java.lang.Math;


public class Test {
    public static double add(double a, int b) {
        return a + b;
    }
    public static double add(int a, double b) {
        return a + b;
    }
    public static int add(int a, int b) {
        return a + b;
    }
    public static void main10(String[] args) {
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int t = random.nextInt(100) + 1;

        do {
            System.out.println("请输入数字");
            int k = scanner.nextInt();
            if(k > t) {
                System.out.println("猜大了");
            } else if (k < t) {
                System.out.println("猜小了");
            } else {
                System.out.println("猜对了");
                break;
            }
        } while (true);
    }
    public static int sum(int a, int b) {
        return a + b;
    }
    public static int isLeapYear(int year) {
        if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
            return 1;
        }
        return 0;
    }
    public static void main9(String[] args) {
//        System.out.println(sum(1,2));
        System.out.println(isLeapYear(2003+1));
    }
    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 31; i >= 0; i--) {
            System.out.print((n >> i) & 1);
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;
        while(n != 0) {
            n = n & (n - 1);
            count++;
        }
        System.out.println(count);
    }
    public static void main6(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入模式（类似水仙花 1-10）");
        int k = scanner.nextInt();
        for(long i = (long)Math.pow(10, k - 1); i < (long)Math.pow(10, k); i++) {
            long sum = 0;
            long num = i;
            while(num != 0) {
                sum += (long)Math.pow(num % 10, k);
                num /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }
    }
    public static void main5(String[] args) {
        for(int i = 1; i <= 9; i++) {
            for(int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j + "=" + i * j + " ");
            }
            System.out.println();
        }
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String pass = "123456";
        int count = 3;
        do {
            String p = scanner.nextLine();
            if(p.equals(pass)) {
                System.out.println("密码正确！");
                break;
            } else {
                count--;
                if(count != 0) {
                    System.out.println("密码错误！还剩下" + count + "次机会！");
                }
            }
        }
        while(count > 0);
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()) {
            int n = scanner.nextInt();
            for (int i = 0; i < n; i++) {
                int left = i;
                int right = n - i - 1;
                for (int j = 0; j < n; j++) {
                    if(j == left || j == right) {
                        System.out.print("*");
                    } else {
                        System.out.print(" ");
                    }
                }
                System.out.println();
            }
        }
    }
    public static void main2(String[] args) {
        int flag = 1;
        double sum = 0;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0 / i * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int a = 24;
        int b = 18;
        while(a % b != 0) {
            int t = a % b;
            a = b;
            b = t;
        }
        System.out.println(b);
    }
}
